def read_int():
    return int(input())


def read_ints():
    return map(int, input().split(' '))


t = read_int()
for case_num in range(t):
    n = read_int()
    a = list(read_ints())
    s = list(set(a))
    s.sort()
    vis = set()
    for i in a:
        if i in vis:
            s.append(i)
        else:
            vis.add(i)
    print(' '.join(map(str, s)))
